package com.hnhs.demo.controller;

import com.hnhs.demo.model.User;
import com.hnhs.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
@CrossOrigin
public class UserController {
    @Autowired
    private UserService service;
    @RequestMapping("/api/user")
    public List<User> select(){
        List<User> select = service.select();
        return select;
    }

    @RequestMapping("/api/insert")
    public Integer insert(User user){
        return service.insert(user);
    }

}
